home *** CD-ROM | disk | FTP | other *** search
/ Shareware Extravaganza - Disc 4 / Shareware Extravaganza - Over 25,000 Programs (The Ultimate Shareware Company)(Disc 4 of 4)(1993).iso / cad / lcad35.zip / LC.LSP < prev    next >
Lisp/Scheme  |  1991-02-14  |  3KB  |  97 lines

  1.  
  2. ; LaunchCAD Autolisp program version 3.5
  3.  
  4. ; Note: add the line:     (load"lc")     to the end of your ACAD.LSP file.
  5. ; If you do not have an ACAD.LSP file then you can rename this file to ACAD.LSP
  6. ; or add the contents of this file to your present ACAD.LSP file.
  7.  
  8. (princ "\nLoading LaunchCAD...")
  9. (if(< (substr(getvar "ACADVER")1 2) "11")
  10.   (setvar "MENUECHO" 1))                        ; this makes INSERT work right
  11.  
  12. (defun lc_shell (mode dt / ce me dir f)         ; call LaunchCAD in shell mode
  13.   (setq ce (getvar "CMDECHO"))
  14.   (setvar "CMDECHO" 0)                          ; don't echo commands
  15.   (setq me (getvar "MENUECHO"))
  16.   (setvar "MENUECHO" 1)                         ; do echo menu commands
  17.   (if (= dt "d") (progn
  18.     (setq dir (getvar "DWGPREFIX"))
  19.   )
  20.     (setq dir ".")
  21.   )
  22.   (if (null dir) (setq dir "."))
  23. ; (command "sh" "mode co80")                    ; decomment for dual screen
  24.   (command "launchcad" (strcat dir " " mode))   ; invoke LaunchCAD
  25. ; (command "sh" "mode mono")                    ; decomment for dual screen
  26. ; (graphscr)                    ;    "           "
  27.   (command "script" "lc")                       ; run the script
  28.   (if(setq f(open(findfile "lc.scr")"w"))       ; just in case...
  29.        (close f))                ; empty script file.
  30.   (setvar "CMDECHO" ce)                         ; restore CMDECHO
  31.   (setvar "MENUECHO" me)                         ; restore MENUECHO
  32.   (princ)
  33. )
  34.  
  35. ; Note: You may edit this lisp file to rename the following functions
  36. ; to any name that you wish so long as it does not conflict with an
  37. ; AutoCAD internal command.
  38.  
  39. ; Execute LaunchCAD from within AutoCAD (in shell mode)
  40.  
  41. (defun c:lc ()     (lc_shell "shell" "d"))
  42. (defun c:ins ()  (lc_shell "insert" "s"))       ; Insert Mode
  43. (defun c:lisp () (lc_shell "lisp" "s"))         ; Lisp Mode
  44. (defun c:dxf ()  (lc_shell "dxfin" "s"))        ; DXFIN Mode
  45. (defun c:dxb ()  (lc_shell "dxbin" "s"))        ; DXBIN Mode
  46. (defun c:vs ()     (lc_shell "vslide" "s"))       ; VSlide Mode
  47. (defun c:mu ()     (lc_shell "menu" "s"))         ; Menu Mode
  48. (defun fi ()
  49.   (command "launchcad" ". file" )        ; invoke LaunchCAD file Mode
  50.   (princ)
  51. )
  52.  
  53. ; Redefine the QUIT command to run quit.scr in order to
  54. ; bypass the AutoCAD opening menu.
  55.  
  56. (defun c:quit ()
  57.   (setvar "CMDECHO" 0)
  58.   (initget "No Yes")
  59.   (if(= "Yes" (getkword
  60.     "\nDo you really want to discard\nall changes to drawing[y/N]: "))
  61.     (command "script" "quit"))
  62.   (princ)
  63. )
  64.  
  65. ; Redefine the END command to run end.scr in order to
  66. ; bypass the AutoCAD opening menu.
  67.  
  68. (defun c:end ()
  69.   (setvar "CMDECHO" 0)
  70.   (command "script" "end")              ; run end.scr which bypasses menu
  71.   (princ)
  72. )
  73.  
  74. (defun c:wend ()
  75.   (setvar "CMDECHO" 0)
  76.   (command "script" "wend")              ; run wend.scr which saves drawing
  77.   (princ)                 ; using wblock * and bypasses menu
  78. )
  79.  
  80. ; Undefine the AutoCAD drawing editor END and QUIT commands so that
  81. ; the end and quit functions defined above will work in place of the
  82. ; internal commands (.end and .quit will still work like normal)
  83. ; NOTE: (lc:su) MUST be in STARTUP.LSP or the S::STARTUP function
  84. ; in ACAD.LSP
  85.  
  86. (defun lc:su()
  87.   (command "UNDEFINE" "QUIT")
  88.   (command "UNDEFINE" "END")
  89.   (princ "\nEND and QUIT commands redefined...")
  90.   (princ "\nLaunchCAD initialized.")
  91.   (princ)
  92. )
  93.  
  94. (princ "\nLaunchCAD loaded.")
  95. (princ)
  96.  
  97.